//index.js
//获取应用实例
const app = getApp()

Page({
    data: {
        navData: [{
                text: '首页'
            },
            {
                text: '柚子'
            },
            {
                text: '苹果'
            },
            {
                text: '杨梅'
            },
            {
                text: '香蕉'
            },
            {
                text: '纠纷'
            },
            {
                text: '青葱'
            },
            {
                text: '李子'
            },
            {
                text: '苹果'
            }

        ],
        currentTab: 0,
        newList:[
            {
                title:"红富士     75mm     ¥20/斤"
           },
            {
                title: "11111111111111111111111111111111111"
            }
        ]
    },
    onLoad: function() {
        wx.getSystemInfo({
            success: (res) => {
                this.setData({
                    pixelRatio: res.pixelRatio,
                    windowHeight: res.windowHeight,
                    windowWidth: res.windowWidth
                })
            },
        })
    },
    switchNav(event) {
        var cur = event.currentTarget.dataset.current;
        //每个tab选项宽度占1/5
        var singleNavWidth = this.data.windowWidth / 5;
        //tab选项居中                            
        this.setData({
            navScrollLeft: (cur - 2) * singleNavWidth
        })
        if (this.data.currentTab == cur) {
            return false;
        } else {
            this.setData({
                currentTab: cur
            })
        }
    },
    switchNav1(event) {
        var cur = event.currentTarget.dataset.current;
        //每个tab选项宽度占1/5
        var singleNavWidth = this.data.windowWidth / 5;
        //tab选项居中                            
        this.setData({
            navScrollLeft1: (cur - 2) * singleNavWidth
        })
        if (this.data.currentTab1 == cur) {
            return false;
        } else {
            this.setData({
                currentTab1: cur
            })
        }
    },

    //搜索
    onSearchTap: function(e) {
        wx.navigateTo({
            url: '../search/search',
        })
    },
    //全国水果进价表
    onPricetableTap:function(e){
        wx.navigateTo({
            url: '../business/pricetable/pricetable',
        })
    },
    //我的通知
    onMynoticeTap: function (e) {
        wx.navigateTo({
            url: '../farmerend/noticetype/noticetype',
        })
    },
    //订单
    onorderTap:function(e){
        wx.reLaunch({
            url: '../business/order/order',
        })
    },
    //我的
    onFarmerendpersonalTap: function (e) {
        wx.reLaunch({
            url: '../business/buspersonal/buspersonal',
        })
    },
})